package com.haier.npt.security.utils;

import org.springframework.util.Base64Utils;

import com.baomidou.mybatisplus.toolkit.IdWorker;
import com.haier.npt.utils.Md5Util;

public class KeyUtil {

	private String app_key;
	private String app_secret;

	/**
	 * 生成appkey
	 * 
	 * @return
	 */
	public String appKey() {
		String uuid = IdWorker.get32UUID();
		this.app_key  = Base64Utils.encodeToString(uuid.getBytes());
		return  app_key;
	}

	/**
	 * 生成appkey
	 * 
	 * @return
	 */
	public String appScrect() {
		String mw = "key" + app_key;
		app_secret = Base64Utils.encodeToString(Md5Util.getMD5(mw).getBytes());
		return app_secret;
	}
	
	public static void main(String[] args) {
		KeyUtil key =new KeyUtil();
		System.out.println(key.appKey());
		System.out.println(key.appScrect());
	}
}
